package com.tata.study.oss.adapter;

import com.tata.study.oss.entity.FileInfo;
import com.tata.study.oss.util.MinioUtil;
import lombok.SneakyThrows;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.io.InputStream;
import java.util.List;

/**
 * @Author orange7u7
 * @Date 2023/11/20 9:26
 * @PackageName:com.tata.study.oss.adapter
 * @ClassName: QiNiuStorageAdapter
 */

public class QiNiuStorageAdapter implements StorageAdapter{
    @Resource
    private MinioUtil minioUtil;
    @Override
    public void createBucket(String bucket){
    }

    @Override
    public void uploadFile(MultipartFile uploadFile, String bucket, String objectName) {
    }

    @Override
    public String getUrl(String bucket, String objectName) {
        return null;
    }

    @Override
    @SneakyThrows
    public List<String> getAllBucket() {
        return minioUtil.getAllBucket();
    }

    @Override
    @SneakyThrows
    public List<FileInfo> getAllFile(String bucket) {
        return minioUtil.getAllFile(bucket);
    }

    @Override
    @SneakyThrows
    public InputStream downLoad(String bucket, String objectName) {
        return minioUtil.downLoad(bucket, objectName);
    }

    @Override
    @SneakyThrows
    public void deleteBucket(String bucket) {
        minioUtil.deleteBucket(bucket);
    }

    @Override
    @SneakyThrows
    public void deleteObject(String bucket, String objectName) {
        minioUtil.deleteObject(bucket, objectName);
    }

}
